package com.example.tmdraw;

import android.webkit.JavascriptInterface;

import com.google.gson.Gson;
import com.tenma.ventures.base.TMWebFragment;
import com.tenma.ventures.bean.utils.TMSharedPUtil;
import com.tenma.ventures.share.bean.TMLinkShare;
import com.tenma.ventures.share.util.TMShareUtil;

/**
 * Created by Never Fear   on 2018\11\16 0016.
 * Never More....
 */

public class WebFgm extends TMWebFragment {
    @JavascriptInterface
    public void share(String gsonStr){
        TmShareBea bean = new Gson().fromJson(gsonStr, TmShareBea.class);
        TMLinkShare share = new TMLinkShare();
        share.setThumb(bean.getImg());
        share.setDescription(bean.getDes());
        share.setUrl(bean.getUrl());
        share.setTitle(bean.getTitle());

        TMShareUtil.getInstance(getContext()).shareLink(share);

    }
    @JavascriptInterface
    public String getMobile(){
       return TMSharedPUtil.getTMUser(getContext()).getMobile();
    }
}
